/**
 * @file cubic_test.c
 * Cubic interpolation library test demo.
 */
#include <stdio.h>	// fprint
#include <stdlib.h>	// calloc
#include <stdint.h>
#include <math.h>	// exp
#include "cubic_interpolation.h"

/**
 * Create new surface and fill corresponding data fields.
 * @note Make sure that name is big enough!!!
 */
#define surface_create(s, r, c)							\
	float s_ ## s ## _data[(r)*(c)];					\
	surface_t s_ ## s = {.data = s_ ## s ## _data, .row = (r), .col = (c), .name = {#s}};
/**
 * @brief Demonstration function showing how to use resample functions above.
 */
void main(void)
{
#define IN_ROW	7
#define	IN_COL	9
#define OUT_ROW	11
#define	OUT_COL	13

	surface_create(in, IN_ROW, IN_COL);
	surface_create(out, OUT_ROW, OUT_COL);
	surface_create(ref, OUT_ROW, OUT_COL);
	surface_create(delta, OUT_ROW, OUT_COL);

	surface_gauss_init(s_in);
	surface_print(s_in);
	surface_resample(s_in, s_out);
	surface_print(s_out);
	surface_gauss_init(s_ref);
	surface_print(s_ref);
	surface_diff(s_delta, s_out, s_ref);
	surface_print(s_delta);

	return;
}
